package model.EventProperties;

import model.UrlFile;
import model.Interface.IeventProperties;
import android.graphics.Rect;

public class MoveablePictureEventProperties implements IeventProperties{
	
	private Rect primeryLocation;
	private Rect seconderyLocation;
	private UrlFile picUrl;
	public int numOfFrames;
	
	
	public MoveablePictureEventProperties(Rect primeryLocation,
			Rect seconderyLocation, UrlFile picUrl,int numOfFrames) {
		super();
		this.primeryLocation = primeryLocation;
		this.seconderyLocation = seconderyLocation;
		this.picUrl = picUrl;
		this.numOfFrames = numOfFrames;
	}
	
	public UrlFile getFrameUrl(int frameNum)
	{
		
		if (frameNum > 0 && numOfFrames > 1)
		{	
			
			String newFileUrl = picUrl.getFileName().replace( Integer.valueOf(0).toString(),Integer.valueOf(frameNum).toString());
			String newUrl = picUrl.getUrl().replace(picUrl.getFileName(), newFileUrl);
			
			return new UrlFile(newUrl,newFileUrl,picUrl.getFileSuffix());
		}
		else 
		{
			return picUrl;
		}
	}
	
	public UrlFile getPicUrl() {
		return picUrl;
	}

	public void setPicUrl(UrlFile picUrl) {
		this.picUrl = picUrl;
	}

	public Rect getPrimeryLocation() {
		return primeryLocation;
	}
	public void setPrimeryLocation(Rect primeryLocation) {
		this.primeryLocation = primeryLocation;
	}
	public Rect getSeconderyLocation() {
		return seconderyLocation;
	}
	public void setSeconderyLocation(Rect seconderyLocation) {
		this.seconderyLocation = seconderyLocation;
	}
	

}
